package test

import (
	"fmt"
	"path"

	"regexp"
	"strings"
)

func join() string {

	s := path.Join("d", "/b/c", "", "/e")
	fmt.Printf("s: %v\n", s)
	return s
}

/*
// 用于 ..need_title/
filters=(
    r"[_\.\-\[\]/]",
    r"[,;]",
    r"[【】《》（）]",
    r"[hx]26[45]",
    r"mkv",
    r"mp4",
    r"aac",
    r"hevc",
    r"avc",
    r"蓝光",
    r"blueray",
    r"高清",
    r"\\",
    r"  +"
)

// 用于 ..need_title2/

filters2=(
    r"[_\.\-\[\]/]",
    r"[,;]",
    r"[【】《》（）]",
    r"\\",
    r"  +"
)

*/

//// 必须过滤, 不然拼接  格式会错错乱

var (
	compiled_reg, _  = regexp.Compile(`(?i)[_\.\-\[\]/,;:【】《》（）!@#\$%\^\&\*\=\?\<\>]|[hx]26[45]|mkv|mp4|aac|hevc|avc|蓝光|blueray|高清|\\|  +`)
	compiled_reg2, _ = regexp.Compile(`(?i) +`)
)

func titleFilterX(filter int, name string) string {
	if filter == 0 {
		return ""
	}
	name = strings.ReplaceAll(name, "#", " ")
	name = strings.ReplaceAll(name, "$", " ")
	if filter == 1 {
		name = compiled_reg.ReplaceAllString(name, "")
	}
	name = compiled_reg2.ReplaceAllString(name, " ")
	name = strings.Trim(name, " ")
	// switch filter {
	// case 0:
	// 	return ""
	// case 1:
	// 	//todo

	// 	return name
	// case 2:
	// 	return name
	// }
	return name
}
